//
// Copyright 2017 Signal Messenger, LLC
// SPDX-License-Identifier: AGPL-3.0-only
//

#import <SignalServiceKit/TSGroupModel.h>
#import <SignalServiceKit/TSThread.h>

NS_ASSUME_NONNULL_BEGIN

@class DBReadTransaction;
@class DBWriteTransaction;
@class MessageBodyRanges;
@class TSGroupModelV2;

extern NSString *const TSGroupThreadAvatarChangedNotification;
extern NSString *const TSGroupThread_NotificationKey_UniqueId;

@interface TSGroupThread : TSThread

+ (instancetype)new NS_UNAVAILABLE;
- (instancetype)init NS_UNAVAILABLE;
- (instancetype)initWithUniqueId:(NSString *)uniqueId NS_UNAVAILABLE;

- (nullable instancetype)initWithCoder:(NSCoder *)coder NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithGroupModel:(TSGroupModelV2 *)groupModel NS_DESIGNATED_INITIALIZER;

- (instancetype)initWithGrdbId:(int64_t)grdbId
                                       uniqueId:(NSString *)uniqueId
                  conversationColorNameObsolete:(NSString *)conversationColorNameObsolete
                                   creationDate:(nullable NSDate *)creationDate
                            editTargetTimestamp:(nullable NSNumber *)editTargetTimestamp
                             isArchivedObsolete:(BOOL)isArchivedObsolete
                         isMarkedUnreadObsolete:(BOOL)isMarkedUnreadObsolete
                      lastDraftInteractionRowId:(uint64_t)lastDraftInteractionRowId
                       lastDraftUpdateTimestamp:(uint64_t)lastDraftUpdateTimestamp
                           lastInteractionRowId:(uint64_t)lastInteractionRowId
                         lastSentStoryTimestamp:(nullable NSNumber *)lastSentStoryTimestamp
                      lastVisibleSortIdObsolete:(uint64_t)lastVisibleSortIdObsolete
    lastVisibleSortIdOnScreenPercentageObsolete:(double)lastVisibleSortIdOnScreenPercentageObsolete
                        mentionNotificationMode:(TSThreadMentionNotificationMode)mentionNotificationMode
                                   messageDraft:(nullable NSString *)messageDraft
                         messageDraftBodyRanges:(nullable MessageBodyRanges *)messageDraftBodyRanges
                         mutedUntilDateObsolete:(nullable NSDate *)mutedUntilDateObsolete
                    mutedUntilTimestampObsolete:(uint64_t)mutedUntilTimestampObsolete
                          shouldThreadBeVisible:(BOOL)shouldThreadBeVisible
                                  storyViewMode:(TSThreadStoryViewMode)storyViewMode NS_UNAVAILABLE;

// --- CODE GENERATION MARKER

// This snippet is generated by /Scripts/sds_codegen/sds_generate.py. Do not manually edit it, instead run
// `sds_codegen.sh`.

// clang-format off

- (instancetype)initWithGrdbId:(int64_t)grdbId
                      uniqueId:(NSString *)uniqueId
   conversationColorNameObsolete:(NSString *)conversationColorNameObsolete
                    creationDate:(nullable NSDate *)creationDate
             editTargetTimestamp:(nullable NSNumber *)editTargetTimestamp
              isArchivedObsolete:(BOOL)isArchivedObsolete
          isMarkedUnreadObsolete:(BOOL)isMarkedUnreadObsolete
       lastDraftInteractionRowId:(uint64_t)lastDraftInteractionRowId
        lastDraftUpdateTimestamp:(uint64_t)lastDraftUpdateTimestamp
            lastInteractionRowId:(uint64_t)lastInteractionRowId
          lastSentStoryTimestamp:(nullable NSNumber *)lastSentStoryTimestamp
       lastVisibleSortIdObsolete:(uint64_t)lastVisibleSortIdObsolete
lastVisibleSortIdOnScreenPercentageObsolete:(double)lastVisibleSortIdOnScreenPercentageObsolete
         mentionNotificationMode:(TSThreadMentionNotificationMode)mentionNotificationMode
                    messageDraft:(nullable NSString *)messageDraft
          messageDraftBodyRanges:(nullable MessageBodyRanges *)messageDraftBodyRanges
          mutedUntilDateObsolete:(nullable NSDate *)mutedUntilDateObsolete
     mutedUntilTimestampObsolete:(uint64_t)mutedUntilTimestampObsolete
           shouldThreadBeVisible:(BOOL)shouldThreadBeVisible
                   storyViewMode:(TSThreadStoryViewMode)storyViewMode
                      groupModel:(TSGroupModel *)groupModel
NS_DESIGNATED_INITIALIZER NS_SWIFT_NAME(init(grdbId:uniqueId:conversationColorNameObsolete:creationDate:editTargetTimestamp:isArchivedObsolete:isMarkedUnreadObsolete:lastDraftInteractionRowId:lastDraftUpdateTimestamp:lastInteractionRowId:lastSentStoryTimestamp:lastVisibleSortIdObsolete:lastVisibleSortIdOnScreenPercentageObsolete:mentionNotificationMode:messageDraft:messageDraftBodyRanges:mutedUntilDateObsolete:mutedUntilTimestampObsolete:shouldThreadBeVisible:storyViewMode:groupModel:));

// clang-format on

// --- CODE GENERATION MARKER

@property (nonatomic) TSGroupModel *groupModel;
@property (nonatomic, readonly) NSString *groupNameOrDefault;
@property (nonatomic, readonly, class) NSString *defaultGroupName;

@end

NS_ASSUME_NONNULL_END
